Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib.pci: Support short/canonical ("01:00.0") PCI addresses #669

Merged
merged 3 commits into from
Dec 4, 2015

Conversation

lukego
Copy link
Member

@lukego lukego commented Dec 1, 2015

Proposed alternative to #657 after tomatoes were thrown in response to my more complicated proposal.

Adds these two functions:

  • pci.canonical(address) => returns address in short canonical format (01:00.0)
  • pci.qualified(address) => returns address in fully qualified format (0000:01:00.0)

with the intention that users can specify either format and Snabb Switch will prefer the canonical format internally but expand to the qualified format when needed (e.g. for resolving sysfs paths).

This is a user visible change. The PCI device scan and selftest now uses canonical addresses:

$ sudo ./snabb snsh -t lib.hardware.pci
selftest: pci
pciaddress    vendor  device  interface  status    driver      usable
01:00.0       0x8086  0x10fb  p1p1       down      apps.intel.intel_app yes
01:00.1       0x8086  0x10fb  p1p2       down      apps.intel.intel_app yes
02:00.0       0x8086  0x10fb  p2p1       down      apps.intel.intel_app yes
02:00.1       0x8086  0x10fb  p2p2       down      apps.intel.intel_app yes
03:00.0       0x8086  0x10fb  p3p1       down      apps.intel.intel_app yes
03:00.1       0x8086  0x10fb  -          -         apps.intel.intel_app yes
81:00.0       0x8086  0x10fb  p5p1       down      apps.intel.intel_app yes
81:00.1       0x8086  0x10fb  p5p2       down      apps.intel.intel_app yes
82:00.0       0x8086  0x10fb  p6p1       down      apps.intel.intel_app yes
82:00.1       0x8086  0x10fb  p6p2       down      apps.intel.intel_app yes

and software now accepts either format in parameters:

$ sudo SNABB_PCI0=01:00.0 SNABB_PCI1=0000:01:00.1 ./snabb snsh -t apps.intel.intel_app
selftest: intel_app
100 VF initializations:

Running iterated VMDq test...
test #  1: VMDq VLAN=101; 100ms burst. packet sent: 628,830
test #  2: VMDq VLAN=102; 100ms burst. packet sent: 1,745,985
test #  3: VMDq VLAN=103; 100ms burst. packet sent: 2,891,700

This change can potentially break software that depends on always having qualified paths: that would now be considered a bug. (This PR includes a fix for such a problem in packetblaster.)

Adds these two functions:

  pci.canonical(address) => returns address in short canonical format
  pci.qualified(address) => returns address in fully qualified format

with the intention that users can specify either format and Snabb
Switch will prefer the canonical format internally but expand to the
qualified format when needed (e.g. for resolving sysfs paths).

This is a user visible change. The PCI selftest now shows canonical addresses:

    $ sudo ./snabb snsh -t lib.hardware.pci
    selftest: pci
    pciaddress    vendor  device  interface  status    driver      usable
    01:00.0       0x8086  0x10fb  p1p1       down      apps.intel.intel_app yes
    01:00.1       0x8086  0x10fb  p1p2       down      apps.intel.intel_app yes
    02:00.0       0x8086  0x10fb  p2p1       down      apps.intel.intel_app yes
    02:00.1       0x8086  0x10fb  p2p2       down      apps.intel.intel_app yes
    03:00.0       0x8086  0x10fb  p3p1       down      apps.intel.intel_app yes
    03:00.1       0x8086  0x10fb  -          -         apps.intel.intel_app yes
    81:00.0       0x8086  0x10fb  p5p1       down      apps.intel.intel_app yes
    81:00.1       0x8086  0x10fb  p5p2       down      apps.intel.intel_app yes
    82:00.0       0x8086  0x10fb  p6p1       down      apps.intel.intel_app yes
    82:00.1       0x8086  0x10fb  p6p2       down      apps.intel.intel_app yes

and software now accepts either format in parameters:

    $ sudo SNABB_PCI0=01:00.0 SNABB_PCI1=0000:01:00.1 ./snabb snsh -t apps.intel.intel_app
    selftest: intel_app
    100 VF initializations:

    Running iterated VMDq test...
    test #  1: VMDq VLAN=101; 100ms burst. packet sent: 628,830
    test #  2: VMDq VLAN=102; 100ms burst. packet sent: 1,745,985
    test #  3: VMDq VLAN=103; 100ms burst. packet sent: 2,891,700

This change can potentially break software that depends on always
having qualified paths: that would now be considered a bug.
Explicitly expand device PCI addresses to their fully qualified
representation before matching them with the patterns on the command
line.

This is to preserve the behavior of the packetblaster command line
(e.g. accepting 0000: in address patterns) after the pci module
adopted abbreviated canonical addresses in 27c1e6d and will return
abbreviated names by default.
@kbara
Copy link
Contributor

kbara commented Dec 2, 2015

Seems reasonable.

lukego added a commit to lukego/snabb that referenced this pull request Dec 3, 2015
@eugeneia eugeneia merged commit ec8be10 into snabbco:master Dec 4, 2015
@lukego lukego deleted the pci-abbrev branch August 29, 2016 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants